//   Copyright 2009 Pyxis Technologies
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
//

using System;
using Pyxis.FluentSelenium.Locator;

namespace Pyxis.FluentSelenium.Tester
{
    static class ConditionError
    {
        public static SeleniumAssertionException ContentNotMatch(object expectedValue, object actualValue, ILocator locator)
        {
            var message = string.Format("expected '{0}' but found '{1}' in '{2}'", 
                                        expectedValue, actualValue, locator);
            return new SeleniumAssertionException(message);
        }

        public static SeleniumAssertionException ElementShouldNotBeVisible(ILocator locator)
        {
            var message = string.Format("element '{0}' should not be visible", locator);
            return new SeleniumAssertionException(message);
        }

        public static SeleniumAssertionException ElementShouldBeVisible(ILocator locator)
        {
            var message = string.Format("element '{0}' should be visible", locator);
            return new SeleniumAssertionException(message);
        }

        public static SeleniumAssertionException ElementCountDoesNotMatch(int expectedCount, int actualCount, ILocator locator)
        {
            var message = string.Format("expected '{0}' elemnts but found '{1}' in {2}",
                                        expectedCount, actualCount, locator);
            return new SeleniumAssertionException(message);
        }

        public static SeleniumAssertionException ContentNotMatch(string expectedValue, string actualValue, ElementLocator locator, int rowNumber)
        {
            var message = string.Format("expected '{0}' but found '{1}' in for row {2} at {3}",
                                        expectedValue, actualValue, locator, rowNumber);
            return new SeleniumAssertionException(message);
        }

        public static SeleniumAssertionException NotAtExpectedAddress(string expectedAddress, string actualAddress)
        {
            var message = string.Format("expected to be at '{0}' but was at '{1}'",
                                        expectedAddress, actualAddress);
            return new SeleniumAssertionException(message);
        }

        public static SeleniumAssertionException ElementShouldNotBeChecked(string locator)
        {
            var message = string.Format("element '{0}' should not be checked", locator);
            return new SeleniumAssertionException(message);
        }

        public static Exception ElementShouldBeChecked(string locator)
        {
            var message = string.Format("element '{0}' should be checked", locator);
            return new SeleniumAssertionException(message);
        }
    }
}